package com.site.service;

import com.site.dao.NewsDao;
import com.site.entity.NewsEntity;

import java.sql.SQLException;
import java.util.List;

public class NewsService {
    NewsDao dao;

    public NewsService() throws SQLException, ClassNotFoundException {
        dao=new NewsDao();
    }

    public List<NewsEntity> getAll() throws SQLException{
        return dao.getAll();
    }

    public List<NewsEntity> getHots() throws SQLException {
        return dao.getlist("pushtime<now() limit 4");
    }

    public List<NewsEntity> getIndexTitle() throws SQLException{
        return dao.getlist("pushtime<now() limit 3");
    }
}
